package cn.tedu.csmall.business.controller;

import cn.tedu.csmall.business.service.IBusinessService;
import cn.tedu.csmall.commons.pojo.order.dto.OrderAddDTO;
import cn.tedu.csmall.commons.restful.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/base/business")
@Api(tags = "业务触发模块")
public class BusinessController {

    @Autowired
    IBusinessService businessService;

    @PostMapping("")
    @ApiOperation("执行触发业务的方法")
    public JsonResult<Void> buy(OrderAddDTO orderAddDTO){
        businessService.buy(orderAddDTO);
        return JsonResult.ok("提交订单业务已出发具体详情请去后台查看");
    }

}
